<cfcomponent extends="Model">
	<cffunction name="init">
		<cfscript>
			var qryMainPhone = "CASE 
											WHEN Len(LTrim(RTrim(mainPhone))) = '10' 
												THEN '(' + SUBSTRING(mainPhone, 1, 3) + ')' +' '+SUBSTRING(mainPhone, 4, 3) + '-' + SUBSTRING(mainPhone, 7, 4) 
											WHEN Len(LTrim(RTrim(mainPhone))) = '' 
												THEN ' ' END";

			var qrySecondaryPhone = "CASE 
											WHEN Len(LTrim(RTrim(secondaryPhone))) = '10' 
												THEN '(' + SUBSTRING(secondaryPhone, 1, 3) + ')' +' '+SUBSTRING(secondaryPhone, 4, 3) + '-' + SUBSTRING(secondaryPhone, 7, 4) 
											WHEN Len(LTrim(RTrim(secondaryPhone))) = '' 
												THEN ' ' END";

			HasOne(name="UserTypes", foreignKey="userTypeID");
			Property(name="mainPhoneNumber", sql=qryMainPhone);
			Property(name="secondaryPhoneNumber", sql=qrySecondaryPhone);
		</cfscript>
	</cffunction>
	
	<cffunction name="saveUser">
		<cfargument name="$firstNames" required="yes">
		<cfargument name="$lastNames" required="yes">
		<cfargument name="$primaryNumbers" required="yes">
		<cfargument name="$secondaryNumbers" default="">
		<cfargument name="$userTypes" default="yes">
		
		
	</cffunction>
</cfcomponent>